﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_gathering_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../../js/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            getData();
        })

        function getData() {
            $.ajax({
                url: 'page.aspx',
                dataType: 'json',
                success: function (data) {
                    console.log(data);
                    if (data.isend) {
                        $('#info').html(new Date().format('yyyy-MM-dd hh:mm:ss') + '：采集完毕<br />' + $('#info').html());
                    }
                    else {
                        console.log(data.now);
                        $('#info').html(new Date().format('yyyy-MM-dd hh:mm:ss') + '：' + data.now + '<br />' + $('#info').html());
                        getData();
                    }
                },
                error: function (e) {
                    console.log(e);
                    alert('采集出现异常：' + e);
                }
            });
        }

        Date.prototype.format = function (format) {
            var o = {
                "M+": this.getMonth() + 1, //month
                "d+": this.getDate(), //day
                "h+": this.getHours(), //hour
                "m+": this.getMinutes(), //minute
                "s+": this.getSeconds(), //second
                "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
                "S": this.getMilliseconds() //millisecond
            }
            if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
            for (var k in o) if (new RegExp("(" + k + ")").test(format))
                format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
            return format;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="info" style="text-align: left; font-size: 20px; height: 200px; line-height: 30px;">
        正在采集数据,请等待.......
    </div>
    </form>
</body>
</html>
